{% include 'admin/header.html' %}

<body>
  <div class="lyear-layout-web">
    <div class="lyear-layout-container">
      {% include 'admin/nav.html' %}

      <main class="lyear-layout-content">
        <div class="container-fluid">
          <!-- 提示信息 -->
          <div class="alert alert-info alert-dismissible fade show" role="alert">
            <i class="fas fa-info-circle mr-2"></i>
            在此页面编辑用户信息。

          </div>

          <!-- 卡片标题部分 -->
          <div class="card shadow-lg mb-4">
            <header class="card-header d-flex justify-content-between align-items-center">
              <h4 class="card-title mb-0 text-primary">编辑用户</h4>
              <div>
                <a href="{{ url_for('main.user') }}" class="btn btn-outline-primary btn-sm">返回用户列表</a>
              </div>
            </header>

            <!-- 卡片内容部分 -->
            <div class="card-body">
              <form action="{{ url_for('main.edit_user', id=user.id) }}" method="POST">
                <div class="form-group mb-3">
                  <label for="username">用户名</label>
                  <input type="text" id="username" name="username" class="form-control" value="{{ user.username }}" required>
                </div>

                <div class="form-group mb-3">
                  <label for="password">密码</label>
                  <input type="password" id="password" name="password" class="form-control" placeholder="如果不修改密码，请留空">
                </div>

                <div class="form-group mb-3">
                  <label for="employee_id">工号</label>
                  <input type="text" id="employee_id" name="employee_id" class="form-control" value="{{ user.employee_id }}" required>
                </div>

                <div class="form-group mb-3">
                  <label for="gender">性别</label>
                  <select id="gender" name="gender" class="form-control">
                    <option value="男" {% if user.gender == '男' %}selected{% endif %}>男</option>
                    <option value="女" {% if user.gender == '女' %}selected{% endif %}>女</option>
                  </select>
                </div>

                <div class="form-group mb-3">
                  <label for="phone">电话</label>
                  <input type="text" id="phone" name="phone" class="form-control" value="{{ user.phone }}" required>
                </div>

                <!-- 提交按钮 -->
                <div class="d-flex justify-content-between">
                <button type="submit" class="btn btn-success">保存修改</button>
                </div>
              </form>
            </div>
          </div>
        </div>
      </main>
    </div>
  </div>

{% include 'admin/footer.html' %}
</body>
